package com.css.fxfzdzzh.modules.hypergraph.controller;

import com.css.fxfzdzzh.base.response.RestResponse;
import com.css.fxfzdzzh.modules.hypergraph.service.HypergraphService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description: fxfzdzzh
 * @Author: lhl
 * @CreateDate: 2023/6/5 14:26
 * 超图
 */
@RestController
@RequestMapping("/hypergraph")
public class HypergraphController {

    @Resource
    HypergraphService hypergraphService;

    /**
     * 获取超图server口令
     * @return
     */
    @PostMapping("/getServerToken")
    public RestResponse getServerToken(@RequestBody Map<String, Object> map){
        RestResponse restResponse=null;
        try {
            restResponse=hypergraphService.getServerToken(map);
        } catch (Exception e) {
            e.printStackTrace();
            restResponse=RestResponse.fail("获取失败！");
        }
        return restResponse;
    }

    // /**
    //  * tif发布超图服务工具--创建任务
    //  * @return
    //  */
    // @PostMapping("/tifMapLayerToolJobPost")
    // public RestResponse tifMapLayerToolJobPost(@RequestBody Map<String,String> map){
    //     RestResponse restResponse=null;
    //     try {
    //         restResponse=hypergraphService.tifMapLayerToolJobPost(map.get("layerName"),map.get("serverToken"));
    //     } catch (Exception e) {
    //         e.printStackTrace();
    //         restResponse=RestResponse.fail("获取失败！");
    //     }
    //     return restResponse;
    // }
    //
    // /**
    //  * tif发布超图服务工具--根据ID查询任务信息
    //  * @return
    //  */
    // @PostMapping("/tifMapLayerToolJobGet")
    // public RestResponse tifMapLayerToolJobGet(@RequestBody Map<String,String> map){
    //     RestResponse restResponse=null;
    //     try {
    //         restResponse=hypergraphService.tifMapLayerToolJobGet(map.get("jobID"),map.get("serverToken"));
    //     } catch (Exception e) {
    //         e.printStackTrace();
    //         restResponse=RestResponse.fail("获取失败！");
    //     }
    //     return restResponse;
    // }

    /**
      * 点数据集栅格克吕金插值分析提取等值面发布
      * @return
      */
     @PostMapping("/softSoilPointToGridPolygon")
     public RestResponse softSoilPointToGridPolygon(@RequestBody Map<String,String> map){
         RestResponse restResponse=null;
         try {
             String dtId = map.get("dtId");
             String dtcvId = map.get("dtcvId");
             //刷新指定超图工作空间数据源数据集
             hypergraphService.getWorkspaceReload("dzzhTifCount","");
             restResponse=hypergraphService.softSoilPointToGridPolygon(dtId,dtcvId);
         } catch (Exception e) {
             e.printStackTrace();
             restResponse=RestResponse.fail("获取失败！");
         }
         return restResponse;
     }
}
